{% extends extends_template %}

{% block location %}
    <div class="nav"><a href="{% url accounts %}">Accounts</a></div>
	{% if account %}
        <div class="nav"><a href="{% url account_details account_id=account.id %}">{{account.name}}</a></div>
        <div class="nav"><a href="{% url list_account_payments account_id=account.id %}">Payments</a></div>
    {% else %}
        <div class="nav"><a href="{% url list_payments %}">Payments</a></div>
    {% endif %}
    <div class="nav"><a href="{% url new_payment %}">New payment</a></div>
{% endblock %}

{% block content %}
    

{% if form %}
<form method="POST" action="{% url new_payment %}">
{% csrf_token %}
    <table class="form">
    {% for field in form %}
    
        <tr>
            <td>
                {{ field.label_tag }}
            </td>
        </tr>
        
        {% for error in field.errors %}
        <tr>
            <td>
                
                    <span class="error">{{ error }}</span>
                
            </td>
        </tr>
        {% endfor %}
        
        <tr>
            <td>
                {{ field }}
            </td>
        </tr>
        
    {% endfor %}
        <tr>
            <td><input class="submit" type="submit" value="Pay" /></td>
        </tr>
    </table>
</form>
{% else %}
    <p>Payment complete</p>
{% endif %}    

{% endblock %}
